-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add module for writing unit tests #121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I think that this test module that you have written will definitely be a hit among the source academy cadets! Too bad this wasn't yet implemented when I was taking 1101s haha.
The comments I added are generally my opinion (pls don't take any offence) and feel free to contact me if you wish to discuss or argue against any of the points I wrote so that we can learn together as well! :)
This PR is still marked as "draft". @podocarp: Or is it ready for final review? |
Have not written docs yet, but hope someone can look at the code first. |
I've looked through this PR, and as it stands it's basically done. There is an issue though: I don't see any way to have more than Given that Source now supports multiple files and multiple calls to display results on tabs, if we don't mind removing |
I think the vast majority of use cases still involve single-file programs, so as long as it works for a single file, I think we can safely merge it first |
…to jxd-unittest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM based on @leeyi45's comment above, thanks!
Description
Usually testing of programs in source academy is done by commenting and uncommenting code. This is a great big hassle. I have also noticed that students usually only run a single test at a time and comment/uncomment
every single line manually, which makes it even slower. Thus it would be great if we could introduce proper unit testing into Source.
This module adds a few function for writing tests and asserts, as well as a new tab to report on test statuses.

I have generally tried to keep to a style similar to
jest
.Future extensions:
Type of change
How Has This Been Tested?
Added unit tests, as well as manual testing.
Checklist: